#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QtGui>
#include "plotter.h"
#include "project.h"

class MainWindow : public QMainWindow
{
    Q_OBJECT
public:
    MainWindow();

protected slots:
    void changeHome();
    void updatePlot();
    void updatePlot(const QModelIndex& index);
    void savePlotImage();
    void savePlotData();

    void xPlus();
    void xMinus();
    void xMultiply();
    void xDivide();
    void yPlus();
    void yMinus();
    void yMultiply();
    void yDivide();

    void about();

protected:
    void doUpdatePlot();

    Project& getProject(const QString& filepath);

    void readSettings();
    void writeSettings();

    void closeEvent(QCloseEvent* event);

private:
    Plotter* plotter;

    QString homepath;
    QString filepath;
    QMap<QString, Project> projects;

    QTreeView*        fileView;
    QFileSystemModel* dirModel;
    QDockWidget*      dockWidget;

    QMenu* fileMenu;
    QMenu* plotMenu;
    QMenu* viewMenu;
    QMenu* helpMenu;
    QAction* changeHomeAction;
    QAction* exitAction;
    QAction* saveImagAction;
    QAction* saveDataAction;
    QAction* updatePlotAction;
    QAction* zoomingAction;
    QAction* showGridAction;
    QAction* showLineAction;
    QAction* showDotsAction;
    QAction* aboutAction;
    QAction* aboutQtAction;

    QComboBox* xCombo;
    QComboBox* yCombo;
    QDoubleSpinBox* xSpin;
    QDoubleSpinBox* ySpin;
    QAction* xPlusAction;
    QAction* yPlusAction;
    QAction* xMinuAction;
    QAction* yMinuAction;
    QAction* xMultAction;
    QAction* yMultAction;
    QAction* xDiviAction;
    QAction* yDiviAction;
};

#endif // MAINWINDOW_H
